import {getBaseCategoryList} from 'http/sever'
import {getBanners} from 'http/sever'

export default {
    state: ()=>{
        return {
            BaseCategoryList:[],
            Banners:[]
        }
    },
    actions: {
        async getList (store) {
            const {code,data}=await getBaseCategoryList()
            data.length=data.length-2
            if(code===200){
                store.commit('getList',data)
            }
        },
        async getBanners (store) {
            const {code,data}=await getBanners()
            if(code===200){
                store.commit('getBanners',data)
            }
        }
    },
    mutations:{
        getList(state,data){
            state.BaseCategoryList=data;
        },
        getBanners(state,data){
            state.Banners=data;
            console.log(state.Banners)
        }
    }
}